#include "SCTouch.h"

static int readKey()
{
    Wire.beginTransmission(SC05B_ADDRESS);
    Wire.write(KEY_VALUE_REGISTER);

    if (Wire.endTransmission(false) == 0)
    {
        Wire.requestFrom(SC05B_ADDRESS, 1);
        if (Wire.available())
        {
            return Wire.read();
        }
    }

    return -1;
}

SCTouch::SCTouch(int _pin)
{
    this->pin = _pin;
}

SCTouch::~SCTouch()
{
}

void SCTouch::tick()
{
}

Button SCTouch::getButton(int key)
{
    if (this->keyButtons.count(key) > 0)
    {
        return this->keyButtons.at(key);
    }

    Button button(key);
    this->keyButtons[key] = button;
    return button;
}